<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style>
		html,body{
		    height: auto;
		}
		#main{
		    padding: 0.8em 0.6em; color: #4c4c4c;
		}
		.info{
			font-size: 1em;
			margin-bottom: 0.3em;
		}
		
		#site{
			width: 100%;
			height: 1.5em;
			box-sizing: border-box;
		    background-color: #fff;
		    background-image: none;
		    border: 1px solid #ccc;
		    border-radius: 4px;
		    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
		    color: #555;
		    display: block;
		    font-size: 14px;
		    height: 34px;
		    line-height: 1.42857;
		    padding: 6px 12px;
		    transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
		}

    </style>
</head>
<body>
    <div id="wrap">
        <div id="main">
        	<div class="info">自定义网址：</div>
			<input id="site" type="url" placeholder="http://t66y.com" value="" size="30" name="site">
        </div>
    </div>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script>
apiready = function () {
	var site = $api.getStorage('site');
	if("undefined" != typeof site && site.length > 0 && site != 'http://t66y.com'){
		$api.val($api.byId('site'), site);
	}
}

function save_site(){
	var site = $api.val($api.byId('site'));
	if(site.length == 0){
		$api.setStorage('site', 'http://t66y.com');
		api.closeWin({
		    name: 'win_setsite',
		});
		return true;
	}
	
	var re = /^(http:\/\/){1}[0-9A-Za-z\.]+$/;
	if(!re.test(site)){
		api.alert({
		    title: '提示',
		    msg: '地址必须以 http:// 开头，结尾不能有 /',
		    buttons:['确定']
		},function(ret,err){
		});
		return false;
	}
	
	$api.setStorage('site', site);
	api.closeWin({
	    name: 'win_setsite',
	});
	return true;
}

</script>
</body>
</html>